//
//  TianJiaShangHuHaoViewController.m
//  ShouKuang
//
//  Created by CodeYY on 2019/6/3.
//  Copyright © 2019 CodeYY. All rights reserved.
//

#import "TianJiaShangHuHaoViewController.h"
#import "CheXiaoViewController.h"
@interface TianJiaShangHuHaoViewController ()
@property(nonatomic, weak)UITextField *shanghuhaoTF;
@property(nonatomic, weak)UITextField *phoneTF;

@end

@implementation TianJiaShangHuHaoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initNavBar];
    [self initCustomUI];

    // Do any additional setup after loading the view.
}
-(void)initNavBar
{
    WEAKSELF
    UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [leftBtn setImage:[UIImage imageNamed:@"nav_back_red"] forState:UIControlStateNormal];
    [leftBtn setTitle:@"返回" forState:UIControlStateNormal];
    [leftBtn setTitleColor:YYRGB(129, 129, 129) forState:UIControlStateNormal];
    [leftBtn jk_setImagePosition:LXMImagePositionLeft spacing:5];
    [[leftBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
        [weakSelf.navigationController popViewControllerAnimated:YES];
    }];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
    
    self.title = @"添加商户号";
}



-(void)initCustomUI
{
    __weak typeof(self) weakSelf = self;
    UIView *contentView = [UIView new];
    [self.view addSubview:contentView];
    contentView.backgroundColor = [UIColor whiteColor];
    [contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.offset(0);
        make.top.offset(70);
        make.height.mas_equalTo(250);
    }];
    
    UILabel *shanghuaHaoLab = [UILabel new];
    [contentView addSubview:shanghuaHaoLab];
    [shanghuaHaoLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(60);
        make.top.offset(40);
    }];
    shanghuaHaoLab.text = @"输入商户号";
    
    UITextField *shanghuhaoTF = [UITextField new];
    [contentView addSubview:shanghuhaoTF];
    _shanghuhaoTF = shanghuhaoTF;
    [shanghuhaoTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(shanghuaHaoLab);
        make.right.offset(-60);
        make.top.equalTo(shanghuaHaoLab.mas_bottom).offset(20);
        
    }];
    UIView *shanghuhaoline = [UIView new];
    [shanghuhaoTF addSubview:shanghuhaoline];
    [shanghuhaoline mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.offset(0);
        make.height.mas_equalTo(0.5);
    }];
    shanghuhaoline.backgroundColor = [UIColor lightGrayColor];
    
    
    UILabel *phoneLab = [UILabel new];
    [contentView addSubview:phoneLab];
    _phoneTF = phoneLab;
    [phoneLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(60);
        make.top.equalTo(shanghuhaoTF.mas_bottom).offset(30);
    }];
    phoneLab.text = @"输入业务联系人预留手机号";
    
    UITextField *phoneTF = [UITextField new];
    [contentView addSubview:phoneTF];
    [phoneTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(phoneLab);
        make.top.equalTo(phoneLab.mas_bottom).offset(20);
        make.right.equalTo(shanghuhaoTF);
        
        
    }];
    UIView *phoneLine = [UIView new];
    [phoneTF addSubview:phoneLine];
    [phoneLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.offset(0);
        make.height.mas_equalTo(0.5);
    }];
    phoneLine.backgroundColor = [UIColor lightGrayColor];
    
    

    UIButton *sureBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:sureBtn];
    [sureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.offset(0);
        make.top.equalTo(contentView.mas_bottom).offset(40);
        make.height.mas_equalTo(50);
    }];
    sureBtn.backgroundColor = [UIColor whiteColor];
    [sureBtn setTitle:@"继续" forState:UIControlStateNormal];
    [sureBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [[sureBtn rac_signalForControlEvents:UIControlEventTouchUpInside]subscribeNext:^(id x) {
        [weakSelf addAction:x];
    }];
}

-(void)addAction:(UIButton *)btn
{
    CheXiaoViewController *vc = [CheXiaoViewController new];
    [self.navigationController pushViewController:vc animated:YES];
}

@end
